package shujia.day07.ketang;

/*
    一个标准类4.0版本：
        成员变量：使用private关键字修饰
        构造方法：提供一个无参和一个所有参数
        成员方法：getXxx()和setXxx(),以及toString()
 */

class Teacher{
    private String name;
    private int age;

    public Teacher() {
    }

    public Teacher(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    @Override
    public String toString() {
        return "Teacher{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}

public class ObjectDemo2 {
    public static void main(String[] args) {
        Teacher t1 = new Teacher("小虎", 18);
        System.out.println(t1);
    }
}
